<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of GModulo
 *
 * @author Luis Alberto
 */
include("Modulo.php");
include './libs/adodb/adodb.inc.php';
include("./configuracion.php");
class GModulo
{
     private $db;
     private $modulo=null;
     public function __construct()
     {
        $this->modulo = new Modulo();
     }
     public function getmodulos($usrper)
     {
        $db = ADONewConnection(DRIVER);
 	$db->Connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
        // Probando Ejemplo SQL IYECTION
        //$cns = "select * from cliente where email = 'ciromarcelo@gmail.com' -- ";//' or username = '$emailusername' and password = '$password'";
        $cns = "select * from modulo where mod_cod in (select mod_cod from privilegio pri  where pri.per_cod = $usrper)";       
        $rs = $db->Execute($cns);
        $l = $rs->GetRows();
	return $l;
     }
     public function getSubmodulo($idsub)
     {
        $db = ADONewConnection(DRIVER);
 	$db->Connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
        $cns = "select * from menu where men_cod = $idsub";
        $rs = $db->Execute($cns);
        $l = $rs->fetchRow();
	return $l;
     }
}
?>
